package com.yun.morphic;

/**
 * Created by lsy
 * on 2020/9/17 16:38.
 */
public class Test {
    static class Father{
        public int money = 1;
        public Father(){
            money = 2;
            showMoney();
        }

        private void showMoney() {
            System.out.println("i am father, i have $" + money);
        }
    }
    static class Son extends Father{
        public int money = 3;
        public Son(){
            money = 4;
            showMoney();
        }

        private void showMoney() {
            System.out.println("i am son, i have $" + money);
        }
    }

    public static void main(String[] args) {
        Father f = new Son();
        System.out.println("this is f, has $" + f.money);
    }
}
